﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Wimm.Common.Interfaces.Utils;

namespace Wimm.Common
{
    public class PagedResult<T> : IPagedResult<T>
    {
        private Int32 pageNumber;
        private Int32 pageSize;
        private Int32 totalPages;
        private ObservableCollection<T> data;

        public PagedResult(Int32 _pageNumber, Int32 _pageSize, Int32 _totalPages, IEnumerable<T> _data)
        {
            this.PageNumber = _pageNumber;
            this.PageSize = _pageSize;
            this.TotalPages = _totalPages;
            foreach (var item in _data)
            {
                this.Data.Add(item);                
            }
        }

        public Int32 PageNumber
        {
            get { return this.pageNumber; }
            protected set { this.pageNumber = value; }
        }

        public Int32 PageSize
        {
            get { return this.pageSize; }
            protected set { this.pageSize = value; }
        }

        public Int32 TotalPages
        {
            get { return this.totalPages; }
            protected set { this.totalPages = value; }
        }

        public ObservableCollection<T> Data
        {
            get { return this.data; }
            protected set { this.data = value; }
        }
    }
}
